Explore City venues (Delhi)

The city venue data will be use to explore the cities.

  • Firstly the most no a venue will be extracted from a particular city.
  • Then the top 10 most common venue for each neighborhood will be extracted and then the neighborhood will be clustered by kmeans on the basis of most common venues
In [240]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

Initialize an array of cities in which we are interested in

In [241]:
# initialize cities array and perform exploratory data analysis on the selected city
cities = ['Delhi','Mumbai','Kolkata','Chennai']
city = cities[0]
city_venues = pd.read_csv(city + '_venues.csv',index_col = 0)
city_venues.head()
Out[241]:
Neighborhood Neighborhood Latitude Neighborhood Longitude Venue Venue Latitude Venue Longitude Venue Category Venue Summary Venue Type
0 Adarsh Nagar 28.720341 77.172661 Giani's 28.717900 77.173907 Ice Cream Shop This spot is popular general
1 Adarsh Nagar 28.720341 77.172661 Axis Bank ATM 28.723032 77.170631 ATM This spot is popular general
2 Adarsh Nagar 28.720341 77.172661 Adarsh Nagar Metro Station 28.716598 77.170436 Light Rail Station This spot is popular general
3 Adarsh Nagar 28.720341 77.172661 Vishyavidyalaya Metro Station@Entry gate #1 n ... 28.715596 77.170981 Train Station This spot is popular general
4 Adarsh Nagar 28.720341 77.172661 Pahalwan Dhaba 28.714594 77.172155 Indian Restaurant This spot is popular general

Exploratory data Analysis

In [242]:
# see number of venues per neighbourhood
city_venues.groupby('Neighborhood').count().head()
Out[242]:
Neighborhood Latitude Neighborhood Longitude Venue Venue Latitude Venue Longitude Venue Category Venue Summary Venue Type
Neighborhood
Adarsh Nagar 6 6 6 6 6 6 6 6
Alaknanda 10 10 10 10 10 10 10 10
Anand Vihar 4 4 4 4 4 4 4 4
Ashok Nagar 38 38 38 38 38 38 38 38
Ashok Vihar 11 11 11 11 11 11 11 11

One hotting the dataframe

In [243]:
# one hot encoding
city_onehot = pd.get_dummies(city_venues[['Venue Category']], prefix="", prefix_sep="")

# add neighborhood column back to dataframe
city_onehot['Neighborhood'] = city_venues['Neighborhood'] 

# move neighborhood column to the first column
fixed_columns = [city_onehot.columns[-1]] + list(city_onehot.columns[:-1])
city_onehot = city_onehot[fixed_columns]

city_onehot['City'] = city
city_onehot.head()
Out[243]:
Yoga Studio ATM Accessories Store Afghan Restaurant Airport American Restaurant Antique Shop Arcade Art Gallery Art Museum ... Track Trail Train Station Turkish Restaurant University Vegetarian / Vegan Restaurant Vietnamese Restaurant Warehouse Store Wine Bar City
0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Delhi
1 0 1 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Delhi
2 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Delhi
3 0 0 0 0 0 0 0 0 0 0 ... 0 0 1 0 0 0 0 0 0 Delhi
4 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Delhi

5 rows × 203 columns

In a city finding the total no. of venues of a particular type and arranginf the dataframe

In [244]:
# group the data per neighborhood
city_grouped = city_onehot.groupby('City').sum().reset_index()
city_grouped = city_grouped.transpose()
city_grouped.columns = city_grouped.iloc[0]
city_grouped.drop(city_grouped.index[[0]],inplace=True)
city_grouped.head()
Out[244]:
City Delhi
Yoga Studio 1
ATM 26
Accessories Store 2
Afghan Restaurant 2
Airport 3

Sorting the data frame on the basis of frequency, taking the top 10 and plotting them.

In [245]:
city_grouped.sort_values([city],ascending=False,inplace=True)
city_grouped.iloc[0:10].plot(kind='bar',figsize=(10,5))
plt.title(city + ' Venue distribution')
plt.ylabel('Total no of venues in the City')
plt.xlabel('Venue Categories')
Out[245]:
Text(0.5, 0, 'Venue Categories')

Now we will find the top 10 most common venues

In [246]:
# First, let's write a function to sort the venues in descending order
def return_most_common_venues(row, num_top_venues):
    row_categories = row.iloc[1:]
    row_categories_sorted = row_categories.sort_values(ascending=False)
    
    return row_categories_sorted.index.values[0:num_top_venues]
In [247]:
city_grouped = city_onehot.groupby('Neighborhood').mean().reset_index()
city_grouped.head()
Out[247]:
Neighborhood Yoga Studio ATM Accessories Store Afghan Restaurant Airport American Restaurant Antique Shop Arcade Art Gallery ... Toy / Game Store Track Trail Train Station Turkish Restaurant University Vegetarian / Vegan Restaurant Vietnamese Restaurant Warehouse Store Wine Bar
0 Adarsh Nagar 0.0 0.166667 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.166667 0.0 0.0 0.0 0.0 0.0 0.0
1 Alaknanda 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0
2 Anand Vihar 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0
3 Ashok Nagar 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0
4 Ashok Vihar 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0

5 rows × 202 columns

In [248]:
# Now let's create the new dataframe and display the top 10 venues for each neighborhood.
num_top_venues = 10

indicators = ['st', 'nd', 'rd']

# create columns according to number of top venues
columns = ['Neighborhood']
for ind in np.arange(num_top_venues):
    try:
        columns.append('{}{} Most Common Venue'.format(ind+1, indicators[ind]))
    except:
        columns.append('{}th Most Common Venue'.format(ind+1))

# create a new dataframe
neighborhoods_venues_sorted = pd.DataFrame(columns=columns)
neighborhoods_venues_sorted['Neighborhood'] = city_grouped['Neighborhood']

for ind in np.arange(city_grouped.shape[0]):
    neighborhoods_venues_sorted.iloc[ind, 1:] = return_most_common_venues(city_grouped.iloc[ind, :], num_top_venues)

neighborhoods_venues_sorted.head()
Out[248]:
Neighborhood 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
0 Adarsh Nagar Electronics Store ATM Indian Restaurant Ice Cream Shop Train Station Light Rail Station Wine Bar Flea Market Food Food & Drink Shop
1 Alaknanda Restaurant BBQ Joint Thai Restaurant Gym Steakhouse New American Restaurant Market Fried Chicken Joint French Restaurant Food Truck
2 Anand Vihar Italian Restaurant Indian Restaurant Hotel Light Rail Station Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
3 Ashok Nagar Indian Restaurant Bakery Multiplex Coffee Shop Fast Food Restaurant Donut Shop Shopping Mall Pizza Place Clothing Store Light Rail Station
4 Ashok Vihar Sandwich Place Pizza Place Asian Restaurant Market Dessert Shop Department Store Coffee Shop Snack Place South Indian Restaurant Indian Restaurant

After finding the top 10 venues in a neighborhood, the neighborhood will be clustered by kmeans algorithm

In [249]:
# import necessary packages
from sklearn.datasets import load_iris
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt

Find optimal k for the clustering process.

In [250]:
city_grouped_clustering = city_grouped.drop('Neighborhood', 1)

sse = {}
for k in range(1, 10):
    # run k-means clustering
    kmeans = KMeans(n_clusters=k, random_state=0,max_iter = 1000).fit(city_grouped_clustering)
    city_grouped_clustering["clusters"] = kmeans.labels_
    sse[k] = kmeans.inertia_ # Inertia: Sum of distances of samples to their closest cluster center
plt.figure()
plt.plot(list(sse.keys()), list(sse.values()))
plt.xlabel("Number of cluster")
plt.ylabel("SSE")
plt.show()

From the graph we find the elbow point an then use it to cluster the neighborhoods.

In [251]:
# set number of clusters
kclusters = 7

city_grouped_clustering = city_grouped.drop('Neighborhood', 1)

# run k-means clustering
kmeans = KMeans(n_clusters=kclusters, random_state=0).fit(city_grouped_clustering)

# check cluster labels generated for each row in the dataframe
kmeans.labels_[0:10] 
Out[251]:
array([0, 1, 3, 1, 1, 1, 0, 1, 1, 1])
In [252]:
df = pd.read_csv(city + '_subdiv.csv',index_col=0)
df.head()
Out[252]:
Neighborhood City Latitude Longitude
0 Adarsh Nagar Delhi 28.720341 77.172661
1 Ashok Vihar Delhi 28.690420 77.176064
2 Azadpur Delhi 28.712420 77.173111
3 Bawana Delhi 28.797661 77.045258
4 Begum Pur Delhi 28.732599 77.052170

Add clustering labels to the dataframe

In [253]:
# add clustering labels
neighborhoods_venues_sorted.insert(0, 'Cluster Labels', kmeans.labels_)

city_merged = df

# merge toronto_grouped with toronto_data to add latitude/longitude for each neighborhood
city_merged = city_merged.join(neighborhoods_venues_sorted.set_index('Neighborhood'), on='Neighborhood')

# drop the column with nan values after join
city_merged.dropna(inplace=True)

city_merged.head() # check the last columns!
Out[253]:
Neighborhood City Latitude Longitude Cluster Labels 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
0 Adarsh Nagar Delhi 28.720341 77.172661 0.0 Electronics Store ATM Indian Restaurant Ice Cream Shop Train Station Light Rail Station Wine Bar Flea Market Food Food & Drink Shop
1 Ashok Vihar Delhi 28.690420 77.176064 1.0 Sandwich Place Pizza Place Asian Restaurant Market Dessert Shop Department Store Coffee Shop Snack Place South Indian Restaurant Indian Restaurant
2 Azadpur Delhi 28.712420 77.173111 1.0 Park Restaurant Ice Cream Shop Train Station Bus Station Light Rail Station French Restaurant Food Truck Food Court Food & Drink Shop
3 Bawana Delhi 28.797661 77.045258 0.0 Accessories Store Business Service Wine Bar Fast Food Restaurant Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
4 Begum Pur Delhi 28.732599 77.052170 2.0 ATM Tourist Information Center Wine Bar Farmers Market Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court

After clustering the data will be visualized in folium.

In [254]:
# Matplotlib and associated plotting modules
import matplotlib.cm as cm
import matplotlib.colors as colors
import folium

Create a function to ge the lat and long of the center of city using geocoder API

In [255]:
# use geocoder library, if not present use !conda install -c conda-forge geocoder
import geocoder
# Google API key is required for the geocoder library to work, save the API key in OS environment variables as GOOGLE_API_KEY
# and then access thay key here
import os
# Use BING_API_KEY when choosing to use bing geocoding instead of google geocoding.
BING_API_KEY = 'AksNN-3luSfNBssyZ3Ju4i78nIrFLt1UtYo--YWQj9oyfxSwyXkdsqykWk3FeTXB' # os.environ['BING_API_KEY']

# This function will take an adress and return the latlng of that adress
def get_latlng(address):
    # using bing geocoder API since it is better.
    g = geocoder.bing(address, key = BING_API_KEY)
    return pd.Series(g.latlng)
In [256]:
# get latitude and longitude of city to center the map
latitude, longitude = get_latlng(city)
print('Lat : ',latitude,' Long : ',longitude)
Lat :  28.642963409423828  Long :  77.11587524414062

Visualize the neighborhoods before clustering

In [257]:
# Function takes in a data frame with Latitude, Longitude, Neighborhood and City columns and shows it on map
def visualize_area_in_map(data):
    # add markers to map
    for lat, lng, neighborhood, city in zip(data['Latitude'], data['Longitude'], data['Neighborhood'], data['City']):
        label = '{}, {}'.format(neighborhood, city)
        label = folium.Popup(label, parse_html=True)
        folium.CircleMarker(
            [lat, lng],
            radius=2,
            popup=label,
            color='blue',
            fill=True,
            fill_color='#3186cc',
            fill_opacity=0.7,
            parse_html=False).add_to(map)  
    
    return map
In [258]:
# create map of Toronto using latitude and longitude values
map = folium.Map(location=[latitude, longitude], zoom_start=10)

# data to be used for map
data = df.dropna()

visualize_area_in_map(data)
Out[258]:

Visualize the clusters

In [259]:
# create map
map_clusters = folium.Map(location=[latitude, longitude], zoom_start=10)

# set color scheme for the clusters
x = np.arange(kclusters)
ys = [i + x + (i*x)**2 for i in range(kclusters)]
colors_array = cm.rainbow(np.linspace(0, 1, len(ys)))
rainbow = [colors.rgb2hex(i) for i in colors_array]

# add markers to the map
markers_colors = []
for lat, lon, poi, cluster in zip(city_merged['Latitude'], city_merged['Longitude'], city_merged['Neighborhood'], city_merged['Cluster Labels']):
    label = folium.Popup(str(poi) + ' Cluster ' + str(cluster), parse_html=True)
    folium.CircleMarker(
        [lat, lon],
        radius=4,
        popup=label,
        color=rainbow[int(cluster)-1],
        fill=True,
        fill_color=rainbow[int(cluster)-1],
        fill_opacity=0.9).add_to(map_clusters)
       
map_clusters
Out[259]:

Exploring the clusters

In [260]:
# print the cluster
city_merged.loc[city_merged['Cluster Labels'] == 0, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[260]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
0 Delhi Electronics Store ATM Indian Restaurant Ice Cream Shop Train Station Light Rail Station Wine Bar Flea Market Food Food & Drink Shop
3 Delhi Accessories Store Business Service Wine Bar Fast Food Restaurant Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
12 Delhi ATM Furniture / Home Store Multiplex Wine Bar Fast Food Restaurant Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
25 Delhi Snack Place ATM Jewelry Store Sporting Goods Shop Light Rail Station Hotel Indian Restaurant Dumpling Restaurant Flea Market Frozen Yogurt Shop
32 Delhi Train Station ATM Park Mini Golf Light Rail Station Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant
36 Delhi ATM Wine Bar Farmers Market Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
41 Delhi Dessert Shop ATM Pizza Place Indian Restaurant Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
44 Delhi ATM Accessories Store Wine Bar Farmers Market Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
45 Delhi Park Clothing Store ATM Ice Cream Shop Mobile Phone Shop Motorcycle Shop Wine Bar Fried Chicken Joint French Restaurant Food Truck
50 Delhi ATM Indian Restaurant Snack Place Smoke Shop Wine Bar Farmers Market Fried Chicken Joint French Restaurant Food Truck Food Court
54 Delhi Clothing Store ATM Park Motorcycle Shop Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
69 Delhi ATM Afghan Restaurant IT Services Food Truck Tourist Information Center Tea Room Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint
78 Delhi Garden Chinese Restaurant ATM Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
89 Delhi Dessert Shop ATM Pizza Place Indian Restaurant Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
94 Delhi Clothing Store ATM Park Motorcycle Shop Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
119 Delhi ATM Spa Smoke Shop Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
131 Delhi Athletics & Sports ATM Spa Pool Farm Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
133 Delhi ATM Wine Bar Farmers Market Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
134 Delhi Spa ATM Fried Chicken Joint Café Wine Bar Fast Food Restaurant Furniture / Home Store Frozen Yogurt Shop French Restaurant Food Truck
159 Delhi ATM Sporting Goods Shop Café Wine Bar Fast Food Restaurant Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
174 Delhi Train Station Mobile Phone Shop Mini Golf Light Rail Station Park ATM IT Services Garden Frozen Yogurt Shop Fried Chicken Joint
In [261]:
city_merged.loc[city_merged['Cluster Labels'] == 1, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[261]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
1 Delhi Sandwich Place Pizza Place Asian Restaurant Market Dessert Shop Department Store Coffee Shop Snack Place South Indian Restaurant Indian Restaurant
2 Delhi Park Restaurant Ice Cream Shop Train Station Bus Station Light Rail Station French Restaurant Food Truck Food Court Food & Drink Shop
5 Delhi Train Station Korean Restaurant Coffee Shop Café Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
6 Delhi Vegetarian / Vegan Restaurant Golf Course Electronics Store Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
8 Delhi Indian Restaurant Coffee Shop Asian Restaurant Light Rail Station Fast Food Restaurant Diner Shopping Mall Snack Place Basketball Court Athletics & Sports
9 Delhi Pizza Place Train Station Playground Mobile Phone Shop Garden Hotel Bar Event Space Food Truck Food Court Food & Drink Shop
10 Delhi Department Store Snack Place Light Rail Station Market Multiplex Fast Food Restaurant Diner Café Indian Restaurant Art Gallery
11 Delhi Shopping Mall Café Wine Bar Fast Food Restaurant Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
13 Delhi Department Store Snack Place Metro Station Café Furniture / Home Store Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
14 Delhi Department Store Indian Restaurant Train Station Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
16 Delhi Indian Restaurant Fast Food Restaurant Donut Shop Café Restaurant Clothing Store BBQ Joint Multiplex Pizza Place Coffee Shop
18 Delhi Train Station Indian Restaurant Light Rail Station Fast Food Restaurant Wine Bar Farm Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
19 Delhi Indian Restaurant Train Station Food Truck Metro Station Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Court
20 Delhi Indian Restaurant Fast Food Restaurant Dessert Shop Market Snack Place Monument / Landmark Museum Mosque Restaurant Hardware Store
21 Delhi Indian Restaurant Fast Food Restaurant Snack Place Market Theme Park Flea Market Movie Theater Mosque Dessert Shop Metro Station
22 Delhi Light Rail Station Pizza Place Asian Restaurant Hotel Grocery Store Donut Shop Chinese Restaurant Sandwich Place Burger Joint Snack Place
23 Delhi Indian Restaurant Fast Food Restaurant Snack Place Market Historic Site Museum Restaurant Flea Market Mosque Monument / Landmark
24 Delhi Indian Restaurant Fast Food Restaurant Donut Shop Café Restaurant Clothing Store BBQ Joint Multiplex Pizza Place Coffee Shop
26 Delhi Pizza Place Indian Restaurant Fast Food Restaurant Coffee Shop Chinese Restaurant Breakfast Spot Donut Shop Snack Place Miscellaneous Shop Sandwich Place
27 Delhi Indian Restaurant Fast Food Restaurant Donut Shop Café Restaurant Clothing Store BBQ Joint Multiplex Pizza Place Coffee Shop
28 Delhi Shopping Mall Convenience Store Cafeteria Coffee Shop Café Wine Bar Fast Food Restaurant Fried Chicken Joint French Restaurant Food Truck
29 Delhi Indian Restaurant Snack Place Hotel Market Flea Market Dessert Shop Mosque Museum Fast Food Restaurant Monument / Landmark
30 Delhi Indie Movie Theater Market Burger Joint Gym Bakery Gift Shop Ice Cream Shop IT Services Farmers Market Frozen Yogurt Shop
33 Delhi Dessert Shop Fast Food Restaurant Indian Restaurant Miscellaneous Shop Food Truck Food & Drink Shop Boutique Wine Bar Flea Market Furniture / Home Store
34 Delhi Park Train Station Metro Station Flea Market Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
37 Delhi Indian Restaurant Fast Food Restaurant Coffee Shop Hotel Pizza Place BBQ Joint Restaurant Food & Drink Shop Snack Place Gym
39 Delhi Smoke Shop Shopping Mall Gym Light Rail Station Wine Bar Farmers Market Fried Chicken Joint French Restaurant Food Truck Food Court
40 Delhi Train Station Indian Restaurant Light Rail Station Fast Food Restaurant Wine Bar Farm Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
42 Delhi Indian Restaurant Fast Food Restaurant Donut Shop Café Restaurant Clothing Store BBQ Joint Multiplex Pizza Place Coffee Shop
43 Delhi Asian Restaurant Coffee Shop Bus Station Café Light Rail Station Tibetan Restaurant Fast Food Restaurant Frozen Yogurt Shop Fried Chicken Joint French Restaurant
... ... ... ... ... ... ... ... ... ... ... ...
145 Delhi Indian Restaurant Fast Food Restaurant Donut Shop Café Restaurant Clothing Store BBQ Joint Multiplex Pizza Place Coffee Shop
146 Delhi Café Chinese Restaurant Fast Food Restaurant Restaurant Pizza Place Coffee Shop Indian Restaurant Pub Park Nightlife Spot
147 Delhi Café Hotel Bistro Indian Restaurant Tea Room Plaza Snack Place Diner Campground Chinese Restaurant
150 Delhi Multiplex Cafeteria Café Coffee Shop Wine Bar Flea Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
151 Delhi Italian Restaurant Market Bed & Breakfast Gym / Fitness Center Cafeteria Nightclub Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
153 Delhi Park Café Bistro Deli / Bodega Plaza Dumpling Restaurant Snack Place Department Store Pizza Place University
154 Delhi Café Fast Food Restaurant Coffee Shop Grocery Store Pizza Place Indian Restaurant Restaurant Chinese Restaurant Donut Shop Department Store
157 Delhi Indian Restaurant Sporting Goods Shop Bar Men's Store Museum Wine Bar Flea Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant
158 Delhi Hotel Lounge Italian Restaurant Bakery Market Gym / Fitness Center French Restaurant Park Chinese Restaurant Café
161 Delhi Indian Restaurant Shopping Mall Market Department Store Pizza Place Pool Cocktail Bar Chinese Restaurant Fast Food Restaurant French Restaurant
163 Delhi Fast Food Restaurant Café Spa Bar Chinese Restaurant Restaurant BBQ Joint Burger Joint Gastropub Italian Restaurant
164 Delhi Café Chinese Restaurant Restaurant Coffee Shop Pizza Place Fast Food Restaurant Nightlife Spot Pub Pharmacy Park
165 Delhi Indian Restaurant Bakery Multiplex Coffee Shop Fast Food Restaurant Donut Shop Shopping Mall Pizza Place Clothing Store Light Rail Station
166 Delhi Light Rail Station Pizza Place Shopping Mall Multiplex Chinese Restaurant Café Indian Restaurant Fast Food Restaurant Hookah Bar Clothing Store
167 Delhi Café Hotel Bistro Indian Restaurant Tea Room Plaza Snack Place Diner Campground Chinese Restaurant
168 Delhi Indian Restaurant Ice Cream Shop Bakery Donut Shop Pizza Place Punjabi Restaurant Clothing Store Multiplex Restaurant Farmers Market
169 Delhi Fast Food Restaurant Indian Restaurant Chinese Restaurant Café Pizza Place Bakery Ice Cream Shop Gym / Fitness Center Fried Chicken Joint Farmers Market
170 Delhi Pizza Place Snack Place Gym BBQ Joint Furniture / Home Store Farmers Market Fried Chicken Joint French Restaurant Food Truck Food Court
171 Delhi Playground Mobile Phone Shop Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
172 Delhi Light Rail Station Pizza Place Shopping Mall Ice Cream Shop Garden Center Garden Multiplex Fast Food Restaurant Dessert Shop Chinese Restaurant
173 Delhi Coffee Shop Pizza Place Donut Shop Fast Food Restaurant Hotel Gym / Fitness Center Market Restaurant Café Bus Station
176 Delhi Hotel Pizza Place Coffee Shop Café Light Rail Station Convenience Store Chinese Restaurant Movie Theater Donut Shop Indian Restaurant
177 Delhi Fast Food Restaurant Bar Breakfast Spot Chinese Restaurant Coffee Shop Asian Restaurant Sandwich Place Bakery Diner Garden Center
178 Delhi Indian Restaurant Café Fast Food Restaurant Shopping Mall Bakery Market Snack Place Pub Garden Food Truck
179 Delhi Indian Restaurant Café Shopping Mall Fast Food Restaurant Hotel Dessert Shop Light Rail Station Snack Place Park Electronics Store
180 Delhi Donut Shop Restaurant Pizza Place Coffee Shop Clothing Store Multiplex Fast Food Restaurant Shopping Mall Italian Restaurant Gym / Fitness Center
181 Delhi Clothing Store Light Rail Station Fast Food Restaurant Donut Shop Coffee Shop Metro Station Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
182 Delhi Indian Restaurant Pizza Place ATM Train Station IT Services Café Health & Beauty Service Farm French Restaurant Food Truck
183 Delhi Fast Food Restaurant Moving Target Metro Station Leather Goods Store Wine Bar Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
184 Delhi BBQ Joint Pizza Place Business Service Café Men's Store Bakery Fast Food Restaurant Wine Bar Frozen Yogurt Shop Fried Chicken Joint

132 rows × 11 columns

In [262]:
city_merged.loc[city_merged['Cluster Labels'] == 2, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[262]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
4 Delhi ATM Tourist Information Center Wine Bar Farmers Market Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
7 Delhi Tourist Information Center Wine Bar Farmers Market Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
48 Delhi Print Shop Tourist Information Center Wine Bar Farm Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
In [263]:
city_merged.loc[city_merged['Cluster Labels'] == 3, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[263]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
15 Delhi Restaurant Clothing Store Hotel Light Rail Station Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop Food
17 Delhi Indian Restaurant Convenience Store Hotel Coffee Shop Restaurant Wine Bar Farm Fried Chicken Joint French Restaurant Food Truck
31 Delhi Hotel Indian Restaurant Restaurant Café Fast Food Restaurant Pizza Place Gift Shop Bakery Bar Coffee Shop
35 Delhi Hotel Pizza Place BBQ Joint Big Box Store Juice Bar Café Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
38 Delhi Historic Site Moving Target Hotel Art Gallery Wine Bar Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
59 Delhi Indian Restaurant Hotel Road Cricket Ground Movie Theater Hostel Flea Market History Museum Wine Bar Food Truck
60 Delhi Indian Restaurant Hotel Pizza Place Gift Shop Light Rail Station Food Wine Bar Farm French Restaurant Food Truck
61 Delhi Hotel Indian Restaurant Fast Food Restaurant Coffee Shop Food & Drink Shop Snack Place BBQ Joint Gym / Fitness Center Pizza Place Bakery
63 Delhi Hotel Indian Restaurant Restaurant Café Fast Food Restaurant Pizza Place Gift Shop Bakery Bar Coffee Shop
65 Delhi Hotel Pizza Place BBQ Joint Big Box Store Juice Bar Café Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck
80 Delhi Juice Bar Shop & Service Hotel Athletics & Sports BBQ Joint Wine Bar Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant
87 Delhi Italian Restaurant Indian Restaurant Hotel Light Rail Station Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
92 Delhi Hotel Indian Restaurant Shopping Mall Big Box Store Asian Restaurant Café Multiplex BBQ Joint Wine Bar Flea Market
120 Delhi Hotel Indian Restaurant Gym Gym / Fitness Center Café Bakery Tea Room Wine Bar Flea Market Fried Chicken Joint
126 Delhi Hotel Gym Café Wine Bar Fast Food Restaurant Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
148 Delhi Furniture / Home Store Hotel Bakery Restaurant Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
149 Delhi Hotel Pizza Place Arcade Multiplex Fast Food Restaurant Sandwich Place Snack Place Bank Indian Restaurant Art Gallery
152 Delhi Hotel Road Indian Restaurant Wine Bar Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop Food
156 Delhi Hotel Snack Place Pizza Place Arcade Furniture / Home Store Multiplex Fast Food Restaurant Sandwich Place Indian Restaurant Art Gallery
160 Delhi Hotel Thai Restaurant Indian Restaurant Spa American Restaurant Hotel Bar Road Farm French Restaurant Food Truck
175 Delhi Indian Restaurant Hotel Chinese Restaurant Burger Joint Food Truck Coffee Shop Wine Bar Fried Chicken Joint French Restaurant Food Court
In [264]:
city_merged.loc[city_merged['Cluster Labels'] == 4, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[264]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
155 Delhi Resort Wine Bar Farm Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop Food
In [265]:
city_merged.loc[city_merged['Cluster Labels'] == 5, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[265]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
57 Delhi Pizza Place Wine Bar Farmers Market Furniture / Home Store Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
76 Delhi Pizza Place Bus Station Astrologer Farmers Market Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
81 Delhi Pizza Place Park Ice Cream Shop Bakery Fast Food Restaurant Wine Bar Farmers Market Fried Chicken Joint French Restaurant Food Truck
128 Delhi Pizza Place ATM Train Station Hotel Falafel Restaurant Fried Chicken Joint French Restaurant Food Truck Food Court Food & Drink Shop
In [266]:
city_merged.loc[city_merged['Cluster Labels'] == 6, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[266]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
144 Delhi Movie Theater Department Store Grocery Store Chinese Restaurant Donut Shop Dumpling Restaurant Frozen Yogurt Shop Fried Chicken Joint Diner French Restaurant
162 Delhi Movie Theater Department Store Indian Restaurant Grocery Store Fast Food Restaurant Frozen Yogurt Shop Fried Chicken Joint French Restaurant Food Truck Food Court
In [ ]: